package 剑指offer;

/**
 * @author zhangjunfei
 * @date 2023/7/20 16:51
 */
public class O_21 {
    public int[] exchange(int[] nums) {
        int[] result = new int[nums.length];
        int i = 0, j = nums.length - 1;
        for (int z = 0; z < nums.length; z++) {
            if (nums[z] % 2 == 0) {
                result[j] = nums[z];
                j--;
            }else{
                result[i] = nums[z];
                i++;
            }
        }
        return result;
    }
}
